package com.liuer.controller;


import com.liuer.service.UserService;
import com.liuer.util.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class UserController {


    @Autowired
    private UserService userService;

    /**
     * 根据用户ID获取用户头像
     * @param userId
     * @return
     */
    @GetMapping("/getImg/{userId}")
    public Result getUImgById(@PathVariable Integer userId) {

        log.info("获取用户id为{}的头像...",userId);
        String url = userService.getUImg(userId);
        return Result.success(url);
    }

}
